package com.youju.parking.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiazhong.youju.commons.bean.Parking;
import com.jiazhong.youju.commons.utils.JSONResult;
import com.youju.parking.fegin.CommunityFegin;
import com.youju.parking.mapper.ParkingMapper;
import com.youju.parking.service.ParkingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ParkingServiceImpl extends ServiceImpl<ParkingMapper, Parking>
        implements ParkingService {
    @Resource
    private CommunityFegin communityFegin;
    @Override
    public JSONResult find() {
        List<Parking> list =list();
        list.forEach(parking-> {
            Integer community_id = parking.getCommunity_id();
            String name = communityFegin.findNameById(community_id).getData().toString();
            System.out.println("----------"+name);
            parking.setCommunity_name(name);
        });

        //redis
        return new JSONResult(true,null,200,list);
    }
}
